
package org.sopt.dev.ImgKnight.agent.Filter;

import java.util.List;
import java.util.Vector;

import org.sopt.dev.ImgKnight.agent.URL.Util.UrlUtil;

public class ExtentionFilter {

	String[] allowExtensionList = null;
	
	public ExtentionFilter(String[] allowExtensionList) {
		this.allowExtensionList = allowExtensionList;
	}
	
	public List<String> list(List<String> list) {
		List<String> newList = new Vector<String>();
		for(String path : list) {
			if( UrlUtil.isFileSpecified(path) ) {
				for(String ext : allowExtensionList) {
					if( path.endsWith(ext) ) {
						newList.add(path);
						break;
					}
				}
			}
			else {
				newList.add(path);
			}
		}
		return newList;
	}
	
}
